/************************************
BigInt
main.cpp - testing file
Calculator for large integers.
CS 133 - Parallel Programming
Professor: Adam Kaplan
Due: 6/3/2011
Collaborators:
Ben Harounian
Justin Kiang
Akhil Rangaraj
************************************/
#include "BigInt.h"
#include <iomanip>
#include <sys/time.h>

using namespace std;
/* Main Function */
int main()
{
timeval tim;
	int threadCount = 1;
	/* TESTING */
	cout << "*********************TESTING*********************" << endl;
	cout << "Thread Count : " << threadCount<< endl <<endl;

	// From String
	string value = "1";
	BigInt temp(value);
	temp += BigInt(1);
	temp += BigInt(1);
	temp += BigInt(1);
	temp += BigInt(1);
	BigInt one("123",threadCount);
             gettimeofday(&tim, NULL);
             double t1=tim.tv_sec+(tim.tv_usec/1000000.0);
	one += BigInt("342",threadCount);
	cout << " 123+342 = " <<one.toString() <<endl;
             gettimeofday(&tim, NULL);
             double t2=tim.tv_sec+(tim.tv_usec/1000000.0);
             printf("%.6lf seconds elapsed\n", t2-t1);
	

	BigInt temp2("123",threadCount);
             gettimeofday(&tim, NULL);
             t1=tim.tv_sec+(tim.tv_usec/1000000.0);
	temp2 *= BigInt("123",threadCount);
	cout <<" 123 * 123 = "<<temp2.toString()<<endl;
             gettimeofday(&tim, NULL);
             t2=tim.tv_sec+(tim.tv_usec/1000000.0);
             printf("%.6lf seconds elapsed\n", t2-t1);
	

	BigInt temp3("123",threadCount);
             gettimeofday(&tim, NULL);
             t1=tim.tv_sec+(tim.tv_usec/1000000.0);
	temp3 &= BigInt("123",threadCount);
	cout <<" 123 & 123 = "<<temp3.toString()<<endl;
             gettimeofday(&tim, NULL);
             t2=tim.tv_sec+(tim.tv_usec/1000000.0);
             printf("%.6lf seconds elapsed\n", t2-t1);



	BigInt temp4("123",threadCount);
             gettimeofday(&tim, NULL);
             t1=tim.tv_sec+(tim.tv_usec/1000000.0);
	temp4 |= BigInt("123",threadCount);
	cout <<" 123 | 123 = "<<temp4.toString()<<endl;
             gettimeofday(&tim, NULL);
             t2=tim.tv_sec+(tim.tv_usec/1000000.0);
             printf("%.6lf seconds elapsed\n", t2-t1);


	BigInt temp5("123",threadCount);
             gettimeofday(&tim, NULL);
             t1=tim.tv_sec+(tim.tv_usec/1000000.0);
	temp5 ^= BigInt("123",threadCount);
	cout <<" 123 ^ 123 = "<<temp5.toString()<<endl;
             gettimeofday(&tim, NULL);
             t2=tim.tv_sec+(tim.tv_usec/1000000.0);
             printf("%.6lf seconds elapsed\n", t2-t1);
 /*BigInt a1(64);
 BigInt a2(32);
 BigInt a3 = a1 & a2;
 BigInt a4 = a1 | a2;
 BigInt a5 = a1 ^ a2;
 BigInt a6 = !a1;

 cout << "a1: " << a1.toString() << endl;
 cout << "a2: " << a2.toString() << endl;
 cout << "a3: " << a3.toString() << endl;
 cout << "a4: " << a4.toString() << endl;
 cout << "a5: " << a5.toString() << endl;
 cout << "a6: " << a6.toString() << endl;*/
	/* End Testing */
	cout << "*******************END TESTING*******************" << endl;

	return 0;
}// End main function
